<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
    <style>
      .parent {
        margin: 80px;
        width: 200px;
        padding: 40px;
        border: 1px solid lightcyan;
      }

      .child {
        width: 40px;
        height: 40px;
        border: 1px solid lightgreen;
      }
    </style>
  </head>
  <body>
    <div class="parent">
      父元素
      <div>内容</div>
      <div class="child">子元素</div>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script>
      $('.parent').mouseenter(function () {
        console.log('鼠标移入容器')
      })

      $('.parent').mouseleave(function () {
        console.log('鼠标移出容器')
      })
    </script>
  </body>
</html>
